#!/usr/bin/env python3

from itertools import permutations

def checkpan(var):
    used = set()
    needed = set(range(1,len(str(var))+1))
    for char in str(var):
        if int(char) in needed:
            if int(char) in used:
                return False
            else:
                needed.remove(int(char))
                used.add(int(char))
    if len(needed) is 0:
        return True
    else:
        return False

def ltoi(list):
    a = ''
    for l in list:
        a += str(l)
    return int(a)
    
def getpan(start,end):
    for x in permutations(range(start,end+1)):
        yield ltoi(x)
        
def getprimes(limit):
	primes = set()
	nums = range(2,limit+1)
	marked = [0] * limit
	p = 2
	for p in nums:
		if not marked[p-2]:
			n = 2
			a = p*n
			while(a <= limit):
				marked[a-2] = 1
				n = n + 1
				a = p*n
	for x in range(limit-1):
		if not marked[x]:
			primes.add(nums[x])
	return primes